
<script type="text/javascript"> 
 setInterval('pepe',1000); 
  function pepe(){
      window.onload = function () {
            alert("onload");
  }	             
  
  }   
</script>  

<script language="javascript">
    jQuery(document).ready(function(){
        jQuery("#list").jqGrid({
            url: '<?php echo site_url() ?>/orden/data',
            mtype: 'POST',
            datatype: 'json',
            colNames:['ID','# Orden','Referencia', 'Servicio','Provincia','Contacto','Celular','date','Mail','Campania'],
            colModel :[
                {name:'id_orden', index:'id_orden',hidden:true},
                {name:'idnum', index:'idnum', width:25},
                {name:'descricion', index:'descricion', width:60},
                {name:'tipo_servicio', index:'tipo_servicio', width:50},
                {name:'provincia', index:'provincia', width:40},
                {name:'name_contacto', index:'name_contacto', width:50},
                {name:'telefono', index:'telefono', width:40},
                {name:'date', index:'date', width:35},
                {name:'mail', index:'mail', width:45},
                {name:'IdCampania', index:'IdCampania', width:45}
                 
                ],
            pager: jQuery('#pager'),
            hiddengrid: true,
            sortname:'id_orden',
            rowNum:10,
            rowList:[10,20,30,40,50],
            sortorder: "asc",
            height: '100%',
            width: '650',
            imgpath: _base_url + 'public/css/jqgrid/flex/images',
            viewrecords: true,
            multiselect: true,
            adjacents:2,
            jsonReader: {repeatitems:false,id_orden: "0" }
        }).navGrid('#pager',{add:false,del:false,edit:false,search:false,position:"left"})
      
        .navButtonAdd('#pager',{caption:"Eliminar", buttonimg: _base_url + "public/images/edit.png", onClickButton:function(){ var id = jQuery('#list').getGridParam('selarrrow');
        if (id.length > 0) {
            if(id.length == 1){
                var ret = jQuery("#list").getRowData(id);
                window.location = _site_url + '/orden/historico/' + ret.id_orden;
            } else { jAlert('Seleccione solo un orden'); }
        } else { jAlert('Debe seleccionar al menos un orden'); }
        return false; } })
        
          .navButtonAdd('#pager',{caption:"Inbaund", buttonimg: _base_url + "public/images/edit.png", onClickButton:function(){ var id = jQuery('#list').getGridParam('selarrrow');
        if (id.length > 0) {
            if(id.length == 1){
                var ret = jQuery("#list").getRowData(id);
                window.location = _site_url + '/orden/inbaund/' + ret.id_orden;
            } else { jAlert('Seleccione solo un orden'); }
        } else { jAlert('Debe seleccionar al menos un orden'); }
        return false; } })
     
        
        
    ; $('#apply_filter').bind('click', applyFilter);
    });
</script>

<div class="table_container">
<table>
    <tr>
    	<td><div id="titulo">Listado de Ordenes</div></td>
    </tr>
    <tr>
        <td>
            <table id="list" class="scroll"></table>
            <div id="pager" class="scroll" style="text-align:center;"></div>
        </td>
	</tr>
 </table>
</div>